---
title: "reply in json · RUAL Documentation"
description: "Reply to any httpconnection as JSON body"
canonical: https://docs.rual.nl/block-types/http connection/httpconnection_set_json
language: en
---

# reply in json

This block is part of the [`json`](https://docs.rual.nl/block-types/json) group and was last modified in core [`v15.0.0`](https://docs.rual.nl/core-versions/150000).

### Type Selection Required

This block requires you to select the data type you want to work with. You must manually select the type using the type selector modal. To access the modal, click the white button on the block.

### Field Selection Required

This block requires field selection (in). You must manually select the fields you want to work with using the field selector modal. To access the modal, click the white button on the block.

Reply to any httpconnection as JSON body

- flow `flow`

- connection required `httpconnection`

- code required `number` HTTP Status Code to return on this response.

- type `value` Sets the Content-Type HTTP header.

Default `application/json`

- Headers `array ` Custom HTTP Headers to set, Array of Objects [{ key: Value, value: Value }]

- fields `v15.0.0` `array ` Response whitelist: dot-paths of the fields the body may carry (e.g. ["name", "_meta.guid"]). Everything not listed is stripped before sending; on an array body the whitelist is applied to each element. Empty or unconnected sends the body as-is. Whitelist on the reply, not blacklist in the flow: a field added to the storage later is then withheld by default instead of leaked by default.

- flow `flow`

- connection `httpconnection`

| `reply with json` |
| --- |
| `return json` |
| `api reply` |
| `reply json` |
| `json return` |
| `json` |

A [function trigger](https://docs.rual.nl/block-types/globals/trigger_custom_function) starts the API flow, which ends in [reply in JSON](https://docs.rual.nl/block-types/http connection/httpconnection_set_json). The connection pin takes the [current request](https://docs.rual.nl/block-types/http connection/httpconnection_current_request), the code pin a status number, and the data pin the payload. The payload is read out of the request query here: [get query](https://docs.rual.nl/block-types/http connection/httpconnection_get_query) hands the query object to [custom field](https://docs.rual.nl/block-types/object/object_get_custom_field), which extracts the name.

![Studio canvas example for the reply in JSON block: answering an API call with JSON.](https://docs.rual.nl/canvas-examples/httpconnection_set_json.png)

### Commonly used with

One of the most-used blocks across production blueprints. It is most often wired together with:

- [number](https://docs.rual.nl/block-types/number/number_default): feeds into this block. Generates a valid number from the filled custom value in the blueprint.

- [current request](https://docs.rual.nl/block-types/http%20connection/httpconnection_current_request): feeds into this block. Retrieves a reference to the current HTTP Connection.

- [new object](https://docs.rual.nl/block-types/object/object_new_fields): feeds into this block. Builds a new object filled with the given fields.

- [branch](https://docs.rual.nl/block-types/flow/branch): feeds into this block.

- [search](https://docs.rual.nl/block-types/storage/function_search): feeds into this block. searches in the given storage based on a query.

- [update document](https://docs.rual.nl/block-types/storage/function_update_document_mutations): feeds into this block. Update document in the given storage and creates a revision for it.

### Used in these guides

These documentation pages use or explain this block:

- [Creating a REST API](https://docs.rual.nl/tutorials/rest-api)

- [Common Blueprint Patterns](https://docs.rual.nl/blueprints/common-patterns)

- [Block Templates, Combinations That Work](https://docs.rual.nl/block-types/block-templates)

- [Quickstart](https://docs.rual.nl/getting-started/quickstart)

- [Block Quick Reference](https://docs.rual.nl/reference/block-quick-reference)

- [Build Your First API](https://docs.rual.nl/cluster/api-quickstart)

- [Finding Blocks](https://docs.rual.nl/block-types/finding-blocks)

### Version history

Introduced in [`v15.0.0`](https://docs.rual.nl/core-versions/150000).
